package com.songlanyun.modules.logisticsconfig.controller.admin;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.songlanyun.common.annotation.SysLog;
import com.songlanyun.common.validator.ValidatorUtils;
import com.songlanyun.common.validator.group.AddGroup;
import com.songlanyun.modules.logisticsconfig.model.dto.LogisticsConfigDTO;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.songlanyun.modules.logisticsconfig.entity.LogisticsConfig;
import com.songlanyun.modules.logisticsconfig.service.LogisticsConfigService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 *  物流公司配置
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-11 09:33:48
 */
@RestController
@RequestMapping("admin/logisticsconfig")
public class LogisticsConfigAdminController  extends AbstractController {
    @Autowired
    private LogisticsConfigService logisticsConfigService;


    /**
     * 信息
     */
    @RequestMapping("/info")
    //@RequiresPermissions("logisticsconfig:shoplogisticsconfig:info")
    public R info(){
		LogisticsConfig shopLogisticsConfig = logisticsConfigService.getLogisticsConfig(getShopId());
        return R.ok().put("data", shopLogisticsConfig);
    }

    /**
     * 保存
     */
    @SysLog("保存物流公司配置")
    @PostMapping("/save")
    //@RequiresPermissions("logisticsconfig:shoplogisticsconfig:save")
    public R save(@RequestBody LogisticsConfigDTO dto){
        LogisticsConfig set = logisticsConfigService.set(getShopId(), dto);
        return R.ok().put("data", set);
    }


}
